package quoridor;

import Util.Constants;
import Util.QuoridorException;

/**
 * Representation of a Player in Quoridor. Currently designed 
 * only for 2 player games.
 *  
 * <pre>
 * Initial version (17/09/2012)
 *  - Added valid flag
 * </pre>
 * @author Ashleey
 */
@SuppressWarnings("unused")

public class Player {
	
	private int wallsPlaced;
	private int vPos;
	private int hPos;
	private String name;
	private int goalEdge;
	
	/**
	 * Creates a Player using their player number (1 or 2) as game
	 * has been designed as 2 player.
	 * @param playerNumber 1 or 2. 
	 */
	public Player(int playerNumber) throws QuoridorException {
		this.wallsPlaced = 0;
		this.name = String.valueOf(playerNumber);
		this.vPos = Constants.CENTRE;		
		
		if (playerNumber == 1) {
			this.hPos 	  = Constants.LEFT_EDGE;
			this.goalEdge = Constants.RIGHT_EDGE;
		} else if (playerNumber == 2) {
			this.hPos 	  = Constants.RIGHT_EDGE;
			this.goalEdge = Constants.LEFT_EDGE;
		} else {
			throw new QuoridorException("Invalid player number (" + playerNumber + ")");
		}
	}

	/**
	 * Increments Player.wallsPlaced. Should be called 
	 * whenever the Player places a valid wall.
	 */
	public void validWallPlaced () {
		this.wallsPlaced++;
	}
	
	public int getWallsPlaced() {
		return wallsPlaced;
	}

	public int getvPos() {
		return vPos;
	}

	public void setvPos(int vPos) {
		this.vPos = vPos;
	}

	public int gethPos() {
		return hPos;
	}

	public void sethPos(int hPos) {
		this.hPos = hPos;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
	
}
